import os 

def isTextFile(fileName):
	if(fileName.find(".cleaned") != -1):
		return True
	return False

FILES =  filter(isTextFile,os.listdir("."))
COMMAND = "python getRanks_topK.py"
LOWER = 5
UPPER = 101
print "Started"

for eachFile in FILES:
	print COMMAND+" "+eachFile+" "+str(1)+" > topK/"+eachFile.split(".")[0]+"_top_"+str(1)+".txt"
	os.system(COMMAND+" "+eachFile+" "+str(1)+" > topK/"+eachFile.split(".")[0]+"_top_"+str(1)+".txt")
	
	for i in range(LOWER,UPPER,5):
		print COMMAND+" "+eachFile+" "+str(i)+" > topK/"+eachFile.split(".")[0]+"_top_"+str(i)+".txt"	
		os.system(COMMAND+" "+eachFile+" "+str(i)+" > topK/"+eachFile.split(".")[0]+"_top_"+str(i)+".txt") 
		
#	for i in range(UPPER+9,1001,10):
#		print COMMAND+" "+eachFile+" "+str(i)+" > topK/"+eachFile.split(".")[0]+"_top_"+str(i)+".txt"	
#		os.system(COMMAND+" "+eachFile+" "+str(i)+" > topK/"+eachFile.split(".")[0]+"_top_"+str(i)+".txt") 
